using System;

namespace Fornax020.SerialComm.Exceptions
{
    /// <summary>
    /// 命令执行异常
    /// </summary>
    public class CommandException : SerialException
    {
        public string CommandName { get; }
        
        public CommandException(string commandName) : base($"命令执行失败: {commandName}")
        {
            CommandName = commandName;
        }
        
        public CommandException(string commandName, string message) : base($"命令执行失败: {commandName} - {message}")
        {
            CommandName = commandName;
        }
        
        public CommandException(string commandName, string message, Exception innerException) : base($"命令执行失败: {commandName} - {message}", innerException)
        {
            CommandName = commandName;
        }
    }
}
